package com.icore.ui.adapter;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.icore.R;
import com.icore.bean.Gouche;

public class GoucheAdapter extends MainBaseAdapter<Gouche> {

	public GoucheAdapter(Activity context) {
		super(context);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;

		View itemView = convertView;
		if (itemView == null) {
			itemView = mContext.getLayoutInflater().inflate(R.layout.gouche_list_item, null);

			holder = new ViewHolder();
			holder.carNo = (TextView) itemView.findViewById(R.id.carNoTV);
			holder.customerName = (TextView) itemView.findViewById(R.id.customerNameTV);
			holder.createData = (TextView) itemView.findViewById(R.id.createDataTV);
			holder.state = (TextView) itemView.findViewById(R.id.stateTV);

			itemView.setTag(holder);
		} else {
			holder = (ViewHolder) itemView.getTag();
		}

		holder.carNo.setText(mList.get(position).getCarNo());
		holder.customerName.setText(mList.get(position).getCustomerName());
		holder.createData.setText(mList.get(position).getCreateData());
		holder.state.setText(mList.get(position).getState());

		return itemView;
	}

	static class ViewHolder {
		TextView carNo;
		TextView customerName;
		TextView createData;
		TextView state;
	}
}
